<template>
  <div class="heritageRoad">
    <!-- header -->
    <Head />
    <Banner />
    <Nav />
    <!-- /header -->

    <div class="main">
      <div class="middle">
        <!-- 导航栏 -->
        <!-- <SideBar></SideBar> -->
        <!-- 导航栏 -->
        <!-- 工作室概况 -->
        <div class="block">
          <!-- 标题 -->
          <div class="title">
            <h3  @click="$router.push({ path: '/heritageroad' })">传承之路</h3>
          </div>
          <!-- 内容 -->
          <div class="content">
            <div class="detail">
              <!-- 左侧照片 -->
              <div class="image">
                <img :src="cczl.zpurl" alt />
              </div>
              <div class="dis">
                <p>
                  <b>姓名：</b>
                  {{cczl.name}}
                </p>

                <p>
                  <b>学历：</b>
                  {{cczl.xl}}
                </p>
                <p>
                  <b>专家职称：</b>
                  {{cczl.zjzc}}
                </p>
                <p style="width: 270px;">
                  <b>门诊时间：</b>
                  {{cczl.mzsj}}
                </p>
              </div>
            </div>
            <div class="con">
              <p>
                <b>医生介绍：</b>
                <br />
                {{cczl.ysjs}}
              </p>
              <p>
                <b>医疗成果：</b>
                <br />
                {{cczl.ylcg}}
              </p>
              <p>
                <b>专家擅长：</b>
                <br />
                {{cczl.goodat}}
              </p>
            </div>
            <!-- <h3>{{cczl.name}}</h3> -->
            <!-- <p style="padding-top:60px">
              <span>{{cczl.addtime | dateFormat}}</span>
              <span>作者：</span>
              <span>{{cczl.adduser}}</span>
              <span>浏览：</span>
              <span>{{cczl.djs}}</span>
            </p>-->
          </div>
        </div>
      </div>
    </div>
    <!-- footer -->
    <Footer></Footer>
    <!-- /footer -->
  </div>
</template>

<script>
import Head from "@/components/Head.vue";
import Banner from "@/components/Banner.vue";
import Nav from "@/components/Nav.vue";
import Footer from "@/components/Footer.vue";
import SideBar from "@/components/SideBar.vue";

export default {
  name: "HeritageRoad",
  components: {
    Head,
    Banner,
    Nav,
    Footer,
    SideBar,
    // Ewm,
  },
  data() {
    return {
      cczl: [], //传承之路
      id: "", //路由id
    };
  },
  created() {
    // 获取路由id
    this.getId();
    this.getMenulist();
  },
  methods: {
    //首页接口
    getMenulist() {
      var query = {
        id: this.id,
        page: 1,
        limit: 10,
      };
      this.$axios
        .get("TCM/cczl", { params: query })
        .then((res) => {
          if (res.status == 200) {
            this.cczl = res.data.data[0];
            console.log(this.cczl);
              if (this.cczl.ysjs) {
                 this.cczl.ysjs = this.removeHTMLTag(this.cczl.ysjs);
              }
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    // 获取路由的id
    getId() {
      this.id = this.$route.params.id;
    },
    removeHTMLTag(str) {
      str = str.replace(/<\/?[^>]*>/g, ""); //去除HTML tag
      str = str.replace(/[ | ]*\n/g, "\n"); //去除行尾空白
      //str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
      str = str.replace(/ /gi, ""); //去掉
      return str;
    },
  },
};
</script>

<style lang="less" scoped>
@media screen and (max-width: 1200px) {
  .heritageRoad .main {
    margin: 0 !important;
  }
}
.heritageRoad {
  background: url("../assets/image/diwen.jpg") repeat-y;
  // 通知道公告
  .main {
    margin: 0 auto;
    margin: 0 25% 0;
    height: 100%;
    background-color: #ffffff;
    overflow: hidden;
    .middle {
      height: 100%;
      padding: 0 10px 10px;
      background-color: #ffffff;
      box-sizing: border-box;
      margin-top: 20px;
      display: flex;
      justify-content: space-between;
      .block {
        flex: 1;
        // margin-left: 20px;
        background-color: #ffffff;
        border: 0.5px solid #ebe4d9;
        border-top: none;
        .content {
          padding: 10px 20px 0;
          // text-align: center;
          margin-bottom: 40px;
          h3 {
            font-size: 24px;
            text-align: center;
            color: #2c3e50;
            margin-bottom: 20px;
          }
          span {
            font-size: 16px;
            margin-right: 10px;
          }
          p {
            margin: 0;
            line-height: 30px;
            letter-spacing: 1px;
            // font-size: 14px;
            font-weight: 500;
            // margin-bottom: 10px;
          }
          .detail {
            display: flex;
            padding-bottom: 20px;
            border-bottom: 1px solid #eaeaea;
            .image {
              width: 250px;
              img {
                width: 100%;
              }
            }

            .dis {
              margin-top: 20px;
              margin-left: 20px;
              display: flex;
              flex-wrap: wrap;
              p {
                margin-right: 10px;
                width: 210px;
              }
            }
          }
          .con {
            margin-top: 30px;
            p {
              margin-bottom: 20px;
              padding-bottom: 10px;
              border-bottom: 1px solid #eaeaea;
            }
            p:last-of-type {
              border: 0;
            }
          }
        }
      }
    }
  }
}
</style>
